﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace MsForgeReboot.Framework.TownCrierChannels {
    public class OAuthTokenConfigurationElement : ConfigurationElement {

        private static ConfigurationProperty _accessToken;
        private static ConfigurationProperty _tokenSecret;
        private static ConfigurationProperty _apiKey;
        private static ConfigurationProperty _apiSecret;
        private static ConfigurationPropertyCollection _collection;
        
        [ConfigurationProperty("accessToken",IsRequired=true)]
        public string AccessToken {
            get { return (string)base[_accessToken]; }
        }

        [ConfigurationProperty("tokenSecret", IsRequired = true)]
        public string TokenSecret {
            get { return (string)base[_tokenSecret]; }
        }

        [ConfigurationProperty("apiKey", IsRequired = true)]
        public string ApiKey {
            get { return (string)base[_apiKey]; }
        }

        [ConfigurationProperty("apiSecret", IsRequired = true)]
        public string ApiSecret {
            get { return (string)base[_apiSecret]; }
        }

        static OAuthTokenConfigurationElement() {
            _accessToken = new ConfigurationProperty(
                "accessToken",
                typeof(string),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _tokenSecret = new ConfigurationProperty(
                "tokenSecret",
                typeof(string),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _apiKey = new ConfigurationProperty(
                "apiKey",
                typeof(string),
                null,
                ConfigurationPropertyOptions.IsRequired
                );
            _apiSecret = new ConfigurationProperty(
                "apiSecret",
                typeof(string),
                null,
                ConfigurationPropertyOptions.IsRequired
                );

            _collection = new ConfigurationPropertyCollection();
            _collection.Add(_accessToken);
            _collection.Add(_tokenSecret);
            _collection.Add(_apiKey);
            _collection.Add(_apiSecret);
        }


        protected override ConfigurationPropertyCollection Properties {
            get {
                return _collection;
            }
        }

    }
}
